home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / RPC / XML / methodHelp.xpl < prev    next >
Encoding:
Extensible Markup Language  |  2008-11-04  |  1.9 KB  |  71 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE methoddef SYSTEM "rpc-method.dtd">
  3. <!--
  4.     Generated automatically by make_method v1.12, Wed Nov  5 03:59:22 2008
  5.  
  6.     Any changes made here will be lost.
  7. -->
  8. <methoddef>
  9. <name>system.methodHelp</name>
  10. <version>1.2</version>
  11. <signature>string string</signature>
  12. <signature>array array</signature>
  13. <help>
  14. Return the help text (such as this) associated with the specified method(s).
  15. If a STRING parameter specifying the method name is passed, the return value
  16. will be a STRING. If multiple methods are queried by passing an ARRAY of
  17. STRING values, then the return value will be an ARRAY of STRING values, as
  18. well.
  19. </help>
  20. <code language="perl">
  21. <![CDATA[
  22. #!/usr/bin/perl
  23. ###############################################################################
  24. #
  25. #   Sub Name:       methodHelp
  26. #
  27. #   Description:    Retrieve any help text for the specified methods.
  28. #
  29. #   Arguments:      NAME      IN/OUT  TYPE      DESCRIPTION
  30. #                   $srv      in      ref       Server object instance
  31. #                   $arg      in      ref/sc    Listref or scalar specification
  32. #
  33. #   Globals:        None.
  34. #
  35. #   Environment:    None.
  36. #
  37. #   Returns:        Success:    string or listref
  38. #                   Failure:    fault object
  39. #
  40. ###############################################################################
  41. sub methodHelp
  42. {
  43.     use strict;
  44.  
  45.     my $srv = shift;
  46.     my $arg = shift;
  47.  
  48.     my $name = $srv->{method_name};
  49.     my @list = (ref $arg) ? @$arg : ($arg);
  50.     my @results = ();
  51.     my $method;
  52.  
  53.     for (@list)
  54.     {
  55.         if (ref($method = $srv->get_method($_)) and (! $method->hidden))
  56.         {
  57.             push(@results, $method->help() || '');
  58.         }
  59.         else
  60.         {
  61.             return RPC::XML::fault->new(302, "$name: Method $_ unknown");
  62.         }
  63.     }
  64.  
  65.     return (ref $arg) ? \@results : $results[0];
  66. }
  67.  
  68. __END__
  69. ]]></code>
  70. </methoddef>
  71.